package com.twu.biblioteca;

import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Thoughtworker
 * Date: 8/22/13
 * Time: 10:31 AM
 * To change this template use File | Settings | File Templates.
 */


public class Output {
    PrintStream printStream;

    public Output(PrintStream printStream) {
        this.printStream = printStream;
    }

    public void printPleaseTalkToLibrarianMessage() {
        printStream.println("Please talk to a librarian. Thank You.");
    }

    public void printBookNotAvailableMessage() {
        printStream.println("Sorry we don't have that book yet.");
    }

    public void printThankYouMessage() {
        printStream.println("Thank You! Enjoy the book.");
    }

    public void welcome() {
        printStream.println("Welcome!");
    }

    public void printBookToReserveMessage() {
        printStream.println("Enter number of book to reserve:");
    }

    public void printValidOptionPrompt() {
        printStream.println("Select a valid option!!");
    }

    public void printMenuOptions(ArrayList<String> options) {
        for (int i = 0; i < options.size(); i++) {
            printStream.println("[" + (i) + "] " + options.get(i) + ";");
        }
    }

    public void printBooks(ArrayList<Book> books) {
        for (Book book : books) {
            printStream.println(book.getName());
        }
    }


    public void printMoviesHeader() {
        String title = String.format("%-23s %-4s %-8s %-5s\n", "Name", "Year", "Director", "Rating");
        printStream.printf(title);
    }

    public void printMovies(ArrayList<Movie> movies) {
        for (Movie m : movies) {
            printStream.println(m.toString());
        }
    }

    public void printPasswordPrompt() {
        printStream.println("Password:");
    }

    public void printUsernamePrompt() {
        printStream.println("Username:");
        //To change body of created methods use File | Settings | File Templates.
    }

    public void printUserDetails(User user) {
        printStream.println("User details:");
        printStream.println(user.showCredentials());
    }

    public void printCommands(List<Command> commands) {
        for (int i = 0; i < commands.size(); i++) {
            printStream.println("[" + (i) + "] " + commands.get(i).getCommandName() + ";");
        }
    }

    public void printLoggedIn() {

        printStream.println("Logged in!");
    }

    public void printNotLoggedIn() {

        printStream.println("Logged off!");
    }
}
